<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <button style="width: 30px;height: 30px;" onclick="dj()"><span></span></button>
</body>
</html>
<script>
    var btn=document.querySelector('botton')
    var sp=document.querySelector('span')
    var num =0
    function dj(){
      num++
      alert(num)
      sp.innerHTML=num
    }
</script>